<template>
  <div class="mineInformationBox">
    <header-box title="个人信息" :showLeft="true" :showRight="true"></header-box>
    <div class="cellBox">
      <div class="cell flex">
        <div class="label">头像</div>
        <div class="rightBox flex">
          <div class="cont">
            <img :src="userImg[0].url" alt class="contImg" />
          </div>
          <x-icon type="ios-arrow-right" size="24" class="iconBox" />
        </div>
        <Uploader upload-url="s" :images="userImg" title :showTip="false"></Uploader>
      </div>
      <div class="cell flex" @click="setName">
        <div class="label">昵称</div>
        <div class="rightBox flex">
          <div class="cont">设置个性昵称</div>
          <x-icon type="ios-arrow-right" size="24" class="iconBox" />
        </div>
      </div>
      <div class="cell flex" @click="popupShow=true">
        <div class="label">性别</div>
        <div class="rightBox flex">
          <div class="cont">{{sex}}</div>
          <x-icon type="ios-arrow-right" size="24" class="iconBox" />
        </div>
      </div>
      <div class="footerBox" @click="deleteShow=true">删除个人信息</div>
      <!-- 性别弹框 -->
      <popup v-model="popupShow">
        <popup-header
          left-text="取消"
          right-text="确定"
          title="请选择性别"
          :show-bottom-border="false"
          @on-click-left="popupShow = false"
          @on-click-right="popupShow = false"
        ></popup-header>
        <group gutter="0">
          <radio :options="sexOptions" v-model="sex"></radio>
        </group>
      </popup>
      <!-- 删除个人信息 -->
      <popup v-model="deleteShow" height="300px" class="deletBox" is-transparent>
        <div style="width: 95%;background-color:#fff;height:290px;margin:0 auto;border-radius:5px;">
          <div class="topBox">
            <div class="title">请选择要删除的个人信息</div>
            <x-icon type="ios-close-outline" size="30" class="closeIcon" @click="deleteShow=false"></x-icon>
          </div>
          <checklist label-position="left" :options="commonList" v-model="checkList"></checklist>
          <div class="corfirmBtn">确认删除</div>
        </div>
      </popup>
    </div>
  </div>
</template>

<script>
import HeaderBox from '@/components/header'
import Uploader from '@/components/Uploader'
import { PopupHeader, Popup, Group, Radio, Checklist } from 'vux'

export default {
  components: {
    HeaderBox,
    Uploader,
    PopupHeader,
    Popup,
    Group,
    Radio,
    Checklist
  },
  data() {
    return {
      popupShow: false,
      deleteShow: false,
      userImg: [{ url: require('../assets/images/0000000000_01.jpg') }],
      sex: '女',
      sexOptions: ['男', '女'],
      checkList: [],
      commonList: [
        { key: '1', value: '头像' },
        { key: '2', value: '昵称' },
        { key: '3', value: '性别' }
      ]
    }
  },

  methods: {
    setName() {
      this.$router.push({
        name: 'nickname',
        query: { data: { id: 1, name: 'ss' } }
      })
    }
  }
}
</script>

<style lang="less" scoped>
.mineInformationBox {
  .cellBox {
    background-color: #fff;
    padding: 0 20px;
    .cell {
      padding: 20px 0;
      border-bottom: 1px solid #eee;
      position: relative;
      &:last-child {
        border-bottom: none;
      }
      /deep/.weui-cell {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        opacity: 0;
        .weui-uploader__input-box {
          display: block !important;
          width: 100%;
          .weui-uploader__input {
          }
        }
        .weui-uploader__input-box.remove {
          display: none !important;
        }
        .weui-uploader__files {
          display: none !important;
        }
      }
      .label {
        font-size: 30px;
      }
      .rightBox {
        margin-left: auto;
        .cont {
          color: #666;
          font-size: 30px;
          .contImg {
            width: 80px;
            height: 80px;
            overflow: hidden;
            border-radius: 50%;
            display: block;
          }
        }
        .iconBox {
          margin-left: 20px;
          fill: #666;
        }
      }
    }
  }
  .footerBox {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    height: 80px;
    line-height: 80px;
    text-align: center;
    background-color: #fff;
    border: 2px solid #eee;
    border-radius: 20px;
    font-size: 30px;
  }
  .deletBox {
    .topBox {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 10px 20px;
      font-size: 36px;
      .title {
        width: 95%;
        text-align: center;
      }
      .closeIcon {
        width: 5%;
        margin-left: auto;
      }
    }
    .corfirmBtn {
      position: absolute;
      bottom: 40px;
      left: 40px;
      right: 40px;
      height: 80px;
      line-height: 80px;
      text-align: center;
      background-image: linear-gradient(-90deg, #ff8f00, #f50 97%);
      border-radius: 20px;
      color: #fff;
      font-size: 30px;
    }
  }
}
</style>